<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>纯CSS实现雪花动态</title>

<style>
body{
  margin: 0; /*外边距*/
  padding: 0; /*内边距*/
  overflow: hidden; /*溢出隐藏*/
  height: 100vh; /*高度*/
}
.section{
  position: relative; /*相对定位*/
  width: 100%;
  height: 100%;
  background:radial-gradient(#333,#000); /*径向渐变*/
}
.set{
  position: absolute; /*绝对定位*/
  width: 100%;
  height: 100%;
  top: 0; /*距上部*/
  left: 0; /*距左部*/
}
img{
  width: 100px;
  user-select: none; /*不可选取*/
}
.set div{
  position: absolute;
  display: block; /*块元素*/
}
.set div:nth-child(1){ /*第一个子元素*/
  left: 20%;
  animation: animate 15s linear infinite; /*动画：name time 线性执行 重复*/
  animation-delay: -7s; /*等待时间*/
}
.set div:nth-child(2){
  left: 50%;
  animation: animate 15s linear infinite;
  animation-delay: -5s;
}
.set div:nth-child(3){
  left: 70%;
  animation: animate 20s linear infinite;
}
.set div:nth-child(4){
  left: 0%;
  animation: animate 15s linear infinite;
  animation-delay: -5s;
}
.set div:nth-child(5){
  left: 85%;
  animation: animate 18s linear infinite;
  animation-delay: -10s;
}
.set div:nth-child(6){
  left: 0%;
  animation: animate 12s linear infinite;
}
.set div:nth-child(7){
  left: 15%;
  animation: animate 14s linear infinite;
}
.set div:nth-child(8){
  left: 60%;
  animation: animate 15s linear infinite;
}
@keyframes animate{ /*动画*/
  0%{
    top:-10%;
    opacity: 0; /*透明度*/
    transform: translateX(20px) rotate(0deg); /*动作 X轴移动 旋转*/
  }
  10%{
    opacity: 1;
  }
  20%{
    transform: translateX(-20px) rotate(45deg);
  }
  40%{
    transform: translateX(-20px) rotate(90deg);
  }
  60%{
    transform: translateX(20px) rotate(130deg);
  }
  80%{
    transform: translateX(-20px) rotate(180deg);
  }
  100%{
    top:110%;
    transform: translateX(-20px) rotate(225deg);
  }
}
.set2{
  transform: scale(2) rotateY(180deg);
  filter: blur(2px); /*模糊*/
  z-index: 3;
}
.set3{
  transform: scale(0.8) rotateX(180deg);
  filter: blur(4px);
  z-index: 2;
}
h2{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  text-align: center; /*居中*/
  margin: 0;
  color: #fff; /*字体颜色*/
  padding: 0;
  font-size: 8em; /*字体大小*/
  font-family: sans-serif; /*字体*/
  z-index: 1; /*Z轴顺序*/
  user-select: none;
}	



/* 滑动导航栏 */
/* 加层级解决滑动失效问题 */
.slide{
  position: absolute; /*绝对定位*/
  z-index: 999;/* 层级 */
  margin: 50px 600px;
  background: #34495e;
  border-radius: 8px; /* 边框圆角 */
  font-size: 0; /* 字体大小 */
  box-shadow: 0 2px 3px 0 rgba(0, 0, 0, .1); /* 阴影 */
}
.slide a {
  font-size: 15px;
  text-transform: uppercase; /* 大写 */
  color: white; /* 字体颜色 */
  text-decoration: none; /* 字体附加效果 */
  line-height: 50px; /* 行高 */
  position: relative; /* 相对定位 */
  z-index: 1; /* 层叠顺序 */
  display: inline-block; /* 行内盒模型 */
  text-align: center; /* 字体居中 */
}
.slide .animation {
  position: absolute; /* 绝对定位 */
  height: 100%;
  top: 0;
  z-index: 0;
  background: #1abc9c;
  width: 100px;
  border-radius: 8px;
  transition: all .5s ease 0s; /* 过渡时间 */
}
a:nth-child(1) { /* 第一个元素a */
  width: 100px;
}
.slide .start-home, a:nth-child(1):hover~.animation {
  width: 100px;
  left: 0;
}
a:nth-child(2) {
  width: 110px;
}
.slide .start-about, a:nth-child(2):hover~.animation {
  width: 100px;
  left: 100px;
}
a:nth-child(3) {
  width: 100px;
}
.slide .start-blog, a:nth-child(3):hover~.animation {
  width: 100px;
  left: 210px;
}
a:nth-child(4) {
  width: 100px;
}
.slide .start-portfolio, a:nth-child(4):hover~.animation {
  width: 100px;
  left: 310px;
}
a:nth-child(5) {
  width: 100px;
}
.slide .start-contact, a:nth-child(5):hover~.animation {
  width: 100px;
  left: 410px;
}
</style>
</head>
<body>



    <div class="section">
        <!-- <h2>Autumn leaves</h2> -->
    <!-- 滑动导航栏 -->
    <div class="slide">   
        <a href="http://www.baidu.com">百度</a>
        <a href="https://www.bilibili.com/">B站</a>
        <a href="https://fanyi.baidu.com/?aldtype=85#en/zh/Slide">翻译</a>
        <a href="https://hao.360.com/">360</a>
        <a href="https://home.firefoxchina.cn/">火狐</a>
        <div class="animation start-home"></div>          
    </div>



        <div class="set"> <!-- 中 -->
            <div><img src="img/f1.png"></div>
            <div><img src="img/f2.png"></div>
            <div><img src="img/f3.png"></div>
            <div><img src="img/f4.png"></div>
            <div><img src="img/f1.png"></div>
            <div><img src="img/f2.png"></div>
            <div><img src="img/f3.png"></div>
            <div><img src="img/f4.png"></div>
        </div>
        <div class="set set2"> <!-- 前 -->
            <div><img src="img/1.png"></div>
            <div><img src="img/2.png"></div>
            <div><img src="img/3.png"></div>
            <div><img src="img/4.png"></div>
            <div><img src="img/1.png"></div>
            <div><img src="img/2.png"></div>
            <div><img src="img/3.png"></div>
            <div><img src="img/4.png"></div>
        </div>
        <div class="set set3"> <!-- 后 -->
            <div><img src="img/1.png"></div>
            <div><img src="img/2.png"></div>
            <div><img src="img/3.png"></div>
            <div><img src="img/4.png"></div>
            <div><img src="img/1.png"></div>
            <div><img src="img/2.png"></div>
            <div><img src="img/3.png"></div>
            <div><img src="img/4.png"></div>
        </div>
    </div>



</body>
</html>
